package com.qianli.cashmama.trade.openApi.enums;

/**
 * @Author: cashmama
 * @Date: 2020/12/2-11:18
 * @Description: TODO
 * @Slogan: To be or not to be
 **/
public enum SelfOrderStatusEnum {
    INIT(1, "INFORMATION TO BE ADDED"),
    AUDIT(2, "AUDITING"),
    AUDIT_PASS(3, "AUDIT_PASS"),
    DISBURSE_FAIL(4, "DISBURSE_FAIL"),
    DISBURSE_SUCCESS(5, "DISBURSE_SUCCESS"),
    OVERDUE(6, "OVERDUE"),
    REPAY_SUCCESS(7, "REPAY_SUCCESS"),
    EARLIER_REPAY_SUCCESS(8, "EARLIER_REPAY_SUCCESS"),
    OVERDUE_REPAY_SUCCESS(9, "OVERDUE_REPAY_SUCCESS"),
    AUDIT_REJECT(10, "AUDIT_REJECT");

    SelfOrderStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;
    private String name;

    public Integer getCode() {
        return code;
    }

    public SelfOrderStatusEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public SelfOrderStatusEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static SelfOrderStatusEnum getOrderStatus(Integer code) {
        SelfOrderStatusEnum orderStatusEnum = null;
        for (SelfOrderStatusEnum statusEnum : SelfOrderStatusEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                orderStatusEnum = statusEnum;
            }
        }
        return orderStatusEnum;
    }
}
